package gdepot

class Goods {

    String title
    String  description
    BigDecimal price
    String photoUrl
    String  author
    String publish
    Category category

    Date createdDate = new Date()
    Date modifiedDate = new Date()


    static belongsTo = [user:User]
    static hasMany = [comments:Comment]
    static constraints = {
        photoUrl(blank: true,nullable: true)
        author blank: true,nullable:true
        publish blank: true, nullable: true
    }
    def beforeUpdate(){
        modifiedDate = new Date()
    }

    def ToString(){
        title
    }
}
